<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC >
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>停车场用户--${headerTitle }</title>
	
  	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1";/><!-- IE的渲染模式 -->
    <meta name="keywords" content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="description" content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="author" content="blackshadowwalker" />
    
	<link href="bootstrap/3/css/bootstrap.css" rel="stylesheet"/>
	<link href="index/css/justified-nav.css" rel="stylesheet">
	<link href="index/css/style.css" rel="stylesheet" >

	<script src="scripts/jquery/jquery-1.7.min.js"></script>
	<script src="bootstrap/3/js/bootstrap.min.js"></script>
	<link href="bootstrap/3/css/datepicker.css" rel="stylesheet"/>
	<script src="bootstrap/3/js/bootstrap-datepicker.js"></script>
	
	<script src="scripts/validateForm.js?t=123"></script>
	<link href="css/common.css" rel="stylesheet"/>
	
	<script type="text/javascript">
		var msg = "${msg}";
		if(msg!="")
			alert(msg);
	</script>

<style>
body {
	margin-left: 10px;
	margin-top: 7px;
}
</style>
</head>

<body>

<div  >
	
	<div>
		<div class="alert-info" style="">
			<a href="${action}" class="btn btn-warning">返回</a>
			<div style="display:inline;margin-left:30px;color:#f00;">
				${msg}
			</div>
		</div >
	</div>
	
	<form id="myform" name="myform" class="form-horizontal" action="${action }?id=${id}&method=${method}" method="post">
		 <s:if test="flag==0">
    		<s:set name="notEmpty" value="'false'" />
	    	</s:if>
	    	<s:else>
	    		<s:set name="notEmpty" value="'true'" />
	    	</s:else>
	 <div class="form-group">
		    <label class="col-sm-2 control-label"> 用户头像:</label>
		    <div class="col-sm-5">
		      	 <input type="hidden" name="userinfo.userPhoto" value="${userinfo.userPhoto}" style="width:200px;"/>
				<img src="${userinfo.userPhoto}" for="userinfo.userPhoto" alt="用户头像"  
					style="width:120px;height:130px;cursor:pointer;" onClick="chooserPhoto();"/>
				<input type="button" class="btns_mouseout" onClick="chooserPhoto();" alt="选择头像" value="..."/>
		    </div>
		  </div>
		  
		<div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>真实姓名</label>
		    <div class="col-sm-5">
				<input type="text" class="form-control" name="userinfo.realName" id="Rname" value="${userinfo.realName}" placeholder="真实姓名" onblur="Form.validate(this,'checkRealName')"  msg="真实姓名"
					isValidate="true" notEmpty="true"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?" leng="20" minLeng="4" />
		      	 <span class="errorMessage">
					<s:property value="errors['userinfo.realName'][0]" /> 
				</span>
		      	(支持汉字、字母、数字、下划线，长度4-20)
		      	</div>
		  </div>
	
		<div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>性别</label>
		    <div class="col-sm-5">
		    <img src="images/radio/man.jpg" alt="男" width="30" height="30"/>
		    <input name="userinfo.gender" type="radio"value="1" checked="checked"/>男
		    <img src="images/radio/male.jpg" alt="女" width="30" height="30"/>
			<input name="userinfo.gender" type="radio"value="2"/>女
			<script>
				$("input:radio[value=${userinfo.gender}]").attr("checked","true");
			</script>
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>个人简介</label>
		    <div class="col-sm-5">
				<input type="text" class="form-control" name="userinfo.introduction" value="${userinfo.introduction}"  placeholder="个人简介" onblur="Form.validate(this,'checkRealName')"  msg="个人简介"
				isValidate="true" notEmpty="fasle"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?"  leng="50" minLeng="4" /> 
		    </div>
		  </div>

		  <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>身份证号</label>
		    <div class="col-sm-5">
				<input type="text" class="form-control" name="userinfo.idCard" value="${userinfo.idCard}"  placeholder="身份证号"
				isValidate="true" notEmpty="false"  notSpecial="true" isIDCard="true"  /> 
				 <span class="errorMessage" >
					<s:property value="errors['userinfo.idCard'][0]" /> 
				</span>
		    </div>
		  </div>

		   <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>电子邮箱</label>
		    <div class="col-sm-5">
				<input type="text" class="form-control" name="userinfo.email" value="${userinfo.email}"  placeholder="电子邮箱" autocomplete="off"
				isValidate="true"  isEmail="true"/> 	
		    </div>
		  </div>
		  	
		  <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>手机号</label>
		    <div class="col-sm-5">
				<input type="text" class="form-control" name="userinfo.phone" value="${userinfo.phone}"  placeholder="手机号码"
				isValidate="true" isMobile="true"/> 
		    </div>
		  </div>
		  
		 <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>密码</label>
		    <div class="col-sm-5">
				<input type="password" class="form-control" name="userinfo.userPasswd" placeholder="密码"  value=""  onblur="Form.validate(this,'checkPassword')" msg="密码"
				isValidate="true" notEmpty="<s:property value="false" />"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?" msg="密码"  leng="20" minLeng="6"/>
				 <span class="errorMessage" >
					<s:property value="errors['userinfo.userPasswd'][0]" />
				</span>
				(支持字母、数字、下划线，长度6-20) 	
		    </div>
		  </div>
		  
		   <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>再次输入密码：</label>
		    <div class="col-sm-5">
		      	<input type="password" class="form-control" confirmSameValue="userinfo.userPasswd"   placeholder="再次输入密码" value="" onblur="Form.validate(this,'checkPassword')"  msg="再次输入密码" 
		      	isValidate="true" notEmpty="<s:property value="false" />"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?"  leng="20" minLeng="6" />
		      	 <span class="errorMessage" >
					<s:property value="errors['userinfo.userPasswd'][0]" />
				</span>
				(支持字母、数字、下划线，长度6-20)
		    </div>
		  </div>
		  
		   <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>支付密码</label>
		    <div class="col-sm-5">
				<input type="password" class="form-control" name="userinfo.payPasswd"  placeholder="支付密码" value="" onblur="Form.validate(this,'checkPassword')"  msg="支付密码"
				isValidate="true" notEmpty="<s:property value="false" />"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?" msg="支付密码"  leng="20" minLeng="6"/> 
					 <span class="errorMessage" >
					<s:property value="errors['userinfo.payPasswd'][0]" />
				</span>
				(支持字母、数字、下划线，长度6-20) 	
		    </div>
		  </div>
		  
		   <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>再次输入支付密码：</label>
		    <div class="col-sm-5">
		      	<input type="password" class="form-control" confirmSameValue="userinfo.payPasswd" placeholder="再次输入支付密码" value="" onblur="Form.validate(this,'checkPassword')"  msg="再次输入支付密码"
		      	isValidate="true" notEmpty="<s:property value="false" />"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?"  leng="20" minLeng="6" />
		      	 <span class="errorMessage" >
					<s:property value="errors['userinfo.payPasswd'][0]" />
				</span>
				(支持字母、数字、下划线，长度6-20)
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <label class="col-sm-2 control-label"><span style="color:#f00">*</span>常用车牌号</label>
		    <div class="col-sm-5">
				<input type="text" class="form-control" name="userinfo.carNo" value="${userinfo.carNo}"  placeholder="常用车牌号,以‘,’隔开"
				isValidate="true" notEmpty="true"  notSpecial="true"  specialChar="~!@#$%^&*()+ |?" leng="10"/>
				 <span class="errorMessage" >
					<s:property value="errors['userinfo.carNo'][0]" /> 
				</span>
		      	(列：陕F8888) 	
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <label for="inputEmail3" class="col-sm-2 control-label"> </label>
		    <div class="col-sm-5">
	    			<input class="btn btn-success btn-lg btn-block"  type=submit value="${headerTitle}"   />
					<input class="btn btn-primary btn-lg btn-block"  type="reset" value="重置"  />
		     </div>
		  </div>
	</form>
	<div style="display:none;" id="uploaddiv">
		<form action="UploadAction?callback=callback"  method="post" ENCTYPE="multipart/form-data" target="hidden_frame" >
			<input type=file name=file onchange="uploadPhoto(this);" />
			<input type="text" name="dir"  value="user/photos" /><br>
		</form>
		<iframe name="hidden_frame"></iframe>
	</div>
</div>
<script type="text/javascript">
  		$(document).ready(
				function() {
					$("#myform input[type='submit']").click(
							function(e) {
								e.preventDefault();//阻止提交按钮的默认 action
								//	  alert("Submit prevented");
								if (!$("#myform").validateForm()) {
									return;
								}
								var btn = $(this);
								btn.val("正在提交...");
								btn.addClass("disabled");
								$(btn).parent().children("input[type='reset']")
										.addClass("disabled");
								$("#myform").submit();
							});
				});
		
  		function uploadPhoto(obj){
  			$(obj).parent().submit();
  		}
  		
  		function callback(json){
  			if(window.console)
  				console.log(json);
			if(json.error==0){
				if(json.data.length>=1)
				{
					$("input[name='userinfo.userPhoto']").val(json.data[0].path);
					$("img[for='userinfo.userPhoto']").attr("src",json.data[0].path);
				}else{
					alert("上传失败");
				}
			}else{
				alert(json.msg);
			}
		}
  		
  		function chooserPhoto(){
  			$("#uploaddiv input[name=file]").click();
  		}
  		
  </script>
	</body>
</html>
